<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>检查项目管理</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
    <style>
        body { background-color: #f8fafc; }
        .table th, .table td { vertical-align: middle; }
    </style>
</head>
<body>

<div class="container mt-5">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <h2>检查项目管理</h2>
        <a th:href="@{/admin/checkItem/add}" class="btn btn-primary">+ 添加新项目</a>
    </div>

    <table class="table table-bordered table-hover">
        <thead class="table-light">
        <tr>
            <th>ID</th>
            <th>项目名称</th>
            <th>科室</th>
            <th>价格</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <tr th:if="${#lists.isEmpty(checkItems)}">
            <td colspan="5" class="text-center">暂无数据</td>
        </tr>
        <tr th:each="item : ${checkItems}">
            <td th:text="${item.id}">ID</td>
            <td th:text="${item.name}">项目名称</td>
            <td th:text="${item.department}">科室</td>
            <td th:text="${item.price} ?: '--'">价格</td>
            <td>
                <a th:href="@{/admin/checkItem/edit/{id}(id=${item.id})}" class="btn btn-sm btn-outline-primary me-2">编辑</a>
                <a th:href="@{/admin/checkItem/delete/{id}(id=${item.id})}"
                   onclick="return confirm('确定要删除该项目吗？')"
                   class="btn btn-sm btn-outline-danger">删除</a>
            </td>
        </tr>
        </tbody>
    </table>
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
